#ifndef accountmanager_utils_bank_h
#define accountmanager_utils_bank_h

#include <utils/utils_decl.h>

#include <utils/address.h>
#include <utils/core/string.h>
#include <utils/core/set.h>

namespace AccountManagerUtils {

//! Information about a bank
/*!
 *  A bank account is uniquely identified by its name. Its also holds optional information about the
 *  address, phone number and fax number of the bank
 */
class _accountmanager_utils_decl Bank {

public:
	Bank();
	Bank(const Bank& rhs);
	Bank(const String& name);
	Bank(const String& name, const Address& address);
	Bank(const String& name, const Address& address, const String& phone_number, const String& fax_number);
	~Bank();
	Bank& operator=(const Bank& rhs);

	bool operator==(const Bank& rhs) const;
	bool operator!=(const Bank& rhs) const;
	
	String& name();
	const String& name() const;
	Address& address();
	const Address& address() const;
	String& phone_number();
	const String& phone_number() const;
	String& fax_number();
	const String& fax_number() const;

private:
	String name_;
	Address address_;
	String phone_number_;
	String fax_number_;
};

inline uint qHash(const Bank& bank) {
	return qHash(bank.name());
}

//===========================================================

//! Library of all banks available on the current session
class _accountmanager_utils_decl BankLib {

public:
	static const Bank* find_bank(const String& name);
	static const Set<Bank>& banks();
	
	~BankLib();

private:
	BankLib();

	static BankLib* instance();

private:
	Set<Bank> banks_;
	static BankLib* instance_;
};

} // namespace AccountManagerUtils

#endif
